
<?= $this->load->view('tp-admin/func/message') ?>
<!-- start id-form -->
<?= form_open() ?>

<table border="0" cellpadding="0" cellspacing="0" id="id-form" style="text-align: left" >
    <tbody>
        <tr>
            <th valign="top"><label>Tên sản phẩm:</label></th>
            <td><input value="<?= isset($product_info) ? $product_info->product_name : "" ?>" type="text" name="product_name" class="inp-form"/></td>
            <td> <?= form_error('product_name'); ?></td>
        </tr>
        <tr>
            <th valign="top"><label>Danh mục sản phẩm:</label></th>
            <td>
                <select name="product_category" style="height: 30px; width:200px; text-transform: uppercase" >
                    <?php foreach ($categories as $row):
                        ?>
                        <option value="<?= $row->category_id ?>" <?php if (isset($product_info) && $product_info->category_id == $row->category_id) echo "selected"; ?>><?= $row->category_name ?></option>
                        <?php
                    endforeach;
                    ?>

                </select>
                &nbsp;&nbsp;    <?= anchor_popup(HOME_PAGE . ADMIN_PAGE . 'admin_category/add_category', 'Thêm danh mục') ?>
            </td>
            <td> </td>
        </tr>
        <tr>
            <th valign="top"><label>Giá công ty:</label></th>
            <td><input value="<?= isset($product_info) ? $product_info->product_company_price : "" ?>" type="text" name="product_company_price" class="inp-form"></td>
            <td><?= form_error('product_company_price'); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><label>Giá tấn phát:</label></th>
            <td><input value="<?= isset($product_info) ? $product_info->product_tan_phat_price : "" ?>" type="text" name="product_tan_phat_price" class="inp-form"></td>
            <td><?= form_error('product_tan_phat_price'); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><label>Thời gian bảo hành:</label></th>
            <td><input value="<?= isset($product_info) ? $product_info->product_guarantee_time : "" ?>" type="text" name="product_guarantee_time" class="inp-form"></td>
            <td><?= form_error('product_guarantee_time'); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><label>Số lượng:</label></th>
            <td><input value="<?= isset($product_info) ? $product_info->product_quantity : "" ?>" type="text" name="product_quantity" class="inp-form"></td>
            <td><?= form_error('product_quantity'); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><label>Phụ kiện kèm theo:</label></th>
            <td>
                <textarea name="product_accessory">
                    <?= isset($product_info) ? $product_info->product_accessories : "" ?>
                </textarea>
            </td>
            <td><?= form_error('product_accessory'); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><label>Tình trạng sản phẩm</label></th>
            <td>

                <label for="chk_product_old">
                    <input type="checkbox" id="chk_product_old" value="old" 
                    <?php
                    if (isset($product_info)) {
                        if ($product_info->product_is_old == 1)
                            echo 'checked="checked"';
                    }else
                        echo 'checked="checked"'
                        ?>

                           name="product_old" />
                    Sản phẩm cũ
                </label>
                <label for="chk_product_new">
                    <input type="checkbox" id="chk_product_new" value="new" 
                    <?php
                    if (isset($product_info)) {
                        if ($product_info->product_is_new == 1)
                            echo 'checked="checked"';
                    }else
                        echo 'checked="checked"'
                        ?>

                           name="product_new" /> 
                    Sản phẩm mới
                </label>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <th valign="top"><label>Trạng thái hiển thị:</label>  </th>
            <td>	
                <ul  style="list-style: none;">
                    <li  style="display: inline; padding-right: 10px"><label><input type="radio" name="product_display_state" <?php if (isset($product_info) && $product_info->product_is_display == 1) echo 'checked="checked"' ?>  value="1" /> Có</label></li>
                    <li  style="display: inline;"><label><input type="radio" name="product_display_state" <?php if (isset($product_info) && $product_info->product_is_display == 0) echo 'checked="checked"' ?>   value="0" />Không</label></li>
                </ul>

            </td>
            <td></td>
        </tr>
        <tr>
            <th valign="top"><label>Tổng quan sản phẩm:</label></th>
            <td><?= $this->load->view('tp-admin/func/product-summary-editor') ?></td>
            <td><?= form_error('product_summary'); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><label>Chi tiết</label></th>
            <td ><?= $this->load->view('tp-admin/func/product-detail-editor') ?>
            </td>
            <td>
                <?= form_error('product_detail'); ?>
            </td>
        </tr>

        <tr>
            <th>&nbsp;</th>
            <td valign="top">
                <input type="submit"  value="Cập nhật"  name="submit" class="form-submit"/>
                <input type="reset" value="Xóa trắng" class="form-reset"/>
            </td>
            <td></td>
        </tr>
    </tbody></table>

<!-- end id-form  -->
</form>